package com.lambda;

import java.util.Arrays;
import java.util.List;

/***
 * @ClassName: SortMyself
 * @Description: 字符串排序，1、字符串长度 2、文字排序
 * @Auther: 送一一块二向箔
 *  List<ResListVo> collect = predictionList.stream().sorted(Comparator.comparing(ResListVO::getAlarmCount).reversed()).collect(Collectors.toList())
 * @Date: 10:35 2022/1/21
 * @version : V1.0
 */
public class SortMyself {

    static List<String> SortMy(){
         String[] strings = new String [] {"唐dfghggf","gdfghggf","gdfghgga","4gdfgdfgdfg","cdfgf","fsdf","gd","vbfcvn","4353","lgd","abfcvn","abccvn"};
         List<String> listString = Arrays.asList(strings);
         listString.sort((a,b)->{
             int lengtha = a.length();
             int lengthb = b.length();
             int count =lengtha-lengthb ;
             if(count > 0 ){
             	return 1;
             }else if (count < 0){
             	return -1;
             }else {
                 for (int i = 0; i < lengtha; i++) {
                     if(a.charAt(i) > b.charAt(i)){
                         return 1;
                     }else if(a.charAt(i) < b.charAt(i)){
                         return -1;
                     }
                 }
                 return 0;
             }
         });

         return listString;

     }

    public static void main(String[] args) {
        List<String> strings = SortMy();
        System.out.println(strings);
    }

}
